package com.sun.dao;

import com.sun.entity.User;
import org.apache.ibatis.annotations.Delete;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
import java.util.Map;

public interface UserMapper extends Mapper<User> {

    @Select("select * from user where id=#{id}")
    User selectUserById(Long id) throws Exception;

   /* @Insert("insert into user(name,sex,age) values(#{name},#{sex},#{age})")
    int addUser(User user) throws Exception;*/

    List<User> getUserList() ;

    int updateByid(User user);

    @Delete("delete from user where id = #{id};")
    void deleteByid(Long id);

    @Select("select * from user where name=#{name} and password=#{password}")
    User login(@Param("name") String name, @Param("password")String password);

    List<User> searchUsersByIdNameSex(String searchTerm); // 保持原样

    @Select("select * from user where name=#{name}")
    User selectUserByname(String username);

    int batchDelete(@Param("ids") List<Long> ids);



    /*@Select("select * from user where name=#{name}")
    User login(@Param("name") String name);*/


}